﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web;
using SSOCommon;

namespace SSOClient
{
    public static class StateManager
    {
        const string TOKENKEY = "SSOClient_Token_Key";
        const string USERKEY = "SSOClient_User_Key";

        public static string Token
        {
            get
            {
                return HttpContext.Current.Session[TOKENKEY] == null ? String.Empty : HttpContext.Current.Session[TOKENKEY].ToString();
            }
            set
            {
                HttpContext.Current.Session[TOKENKEY] = value;
            }
        }

        public static UserInfo User
        {
            get
            {
                return HttpContext.Current.Session[USERKEY] == null ? null : (UserInfo)HttpContext.Current.Session[USERKEY];
            }
            set
            {
                HttpContext.Current.Session[USERKEY] = value;
            }
        }
    }
}
